//
// Created by Administrator on 2024/3/26.
//
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
const int maxn = 50;
bool is_prime[maxn];
int a[20];
int book[20];
int n;
bool solved = false;

void init() {
    fill(is_prime, is_prime + maxn, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= maxn / i; i++) {
        if (is_prime[i]) {
            for (int j = i * i; j < maxn; j += i)is_prime[j] = false;
        }
    }
}

void dfs(int k) {
    if (solved)return;
    if (k >= n) {
        if (is_prime[a[0] + a[n - 1]]) {
            copy(a, a + n, ostream_iterator<int>(cout, " "));
            cout << endl;
            solved = true;
        }
        return;
    }
    for (int i = 0; i < n; i++) {
        if (book[i] == 1)continue;//查表
        if (k > 0 && !is_prime[i + 1 + a[k - 1]])continue;

        a[k] = i + 1;
        book[i] = 1;//写入标记数组
        dfs(k + 1);
        book[i] = 0;//当我们访问完叶子结点后，必须要重置book[i]为未选择状态
    }


}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //ifstream cin("J.in");
    init();
    cin >> n;
    if (n == 1) {
        cout << 1 << endl;
    } else if (n & 1) {
        cout << "no solution" << endl;
    } else {
        a[0] = 1;
        book[0] = true;
        dfs(1);
    }
    return 0;
}